/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dao;

import java.sql.SQLException;

/**
 *
 * @author Rafael Passarela
 */

public class bancoCasehd {
    private Conexao conexao;

    public String getPassword() {
        return "vertrigo";
    }

    public String getUrl() {
        return "jdbc:mysql://localhost/casehd";
    }

    public String getUsername() {
        return "root";
    }

    public boolean conectar() throws SQLException{
        boolean res = false;

        if (conexao == null)
            conexao = new Conexao();

        if (!conexao.isConnected())
            res = conexao.conectar(getUrl(), getUsername(), getPassword());
        else
            res = conexao.isConnected();

        return res;
    }

    public Conexao getConexao() throws SQLException {
        if (conexao == null || !conexao.isConnected() )
            conectar();
         
        return conexao;
    }



}
